package cn.iocoder.yudao.module.jifenyuan.dal.mysql.usercurrentroom;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.jifenyuan.dal.dataobject.usercurrentroom.UserCurrentRoomDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.jifenyuan.controller.app.usercurrentroom.vo.*;

/**
 * 查看当前所在房间 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserCurrentRoomMapper extends BaseMapperX<UserCurrentRoomDO> {

    default PageResult<UserCurrentRoomDO> selectPage(AppUserCurrentRoomPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserCurrentRoomDO>()
                .eqIfPresent(UserCurrentRoomDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserCurrentRoomDO::getRoomId, reqVO.getRoomId())
                .orderByDesc(UserCurrentRoomDO::getId));
    }

    default List<UserCurrentRoomDO> selectList(AppUserCurrentRoomExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<UserCurrentRoomDO>()
                .eqIfPresent(UserCurrentRoomDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserCurrentRoomDO::getRoomId, reqVO.getRoomId())
                .orderByDesc(UserCurrentRoomDO::getId));
    }

}
